<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <h:head>
        <title>MeteoCal - Search results for #{srcBean.search}</title>
        <link href="../css/application.css" rel="stylesheet"></link>
        <link rel="icon" type="image/ico" href="../images/logoico.ico"/>
        <f:metadata>
            <f:viewParam name="src" value="#{srcBean.search}" />
        </f:metadata>
    </h:head>
    <h:body><div id="body">

            <div id="head">
                <a href="personalpage.xhtml"><img src="../images/logo.png" /></a>

                <h:form><p:commandLink action="#{loginBean.logout()}">
                        <p:graphicImage value="../images/logout.png" style="width: 70px; top:140px; left:88%;"/>
                    </p:commandLink></h:form>
            </div>

            <div id="title">
                <p1>MeteoCal</p1><br />
                <p2>Your website to plan your events.</p2>
            </div>

            <div id="bar">
                <a href="personalpage.xhtml" id="ppage" >#{uBean.actualLoggedUser.username} 's MeteoCal</a>
                <a href="calendar.xhtml" id="calendar">Calendar</a>
                <a href="search.xhtml" id="search">Search MeteoCal's friends</a>
            </div>

            <div id="registration"><center><br /><br />
                    Search results for #{srcBean.search}
                    <br /><br />
                    <ui:repeat value="#{srcBean.searchedUser}" var="user"  >
                        <br /><h:body rendered="#{srcBean.resultsFound()}"><li><h:link value="#{user}" outcome="user"
                                                                                       rendered="#{!user.equals(uBean.actualLoggedUser.username)}" style="list-style: none; font-weight: bold;" >
                                <f:param name="user" value="#{user}" />
                                </h:link>
                                <h:link value="#{user}" outcome="calendar"
                                                                                       rendered="#{user.equals(uBean.actualLoggedUser.username)}" style="list-style: none; font-weight: bold;" />
                                <br />
                        #{uBean.findUser(user).name} #{uBean.findUser(user).surname}
                            </li></h:body>
                    </ui:repeat>
                    <h:outputText value="No results found" rendered="#{srcBean.noResultsFound()}"/>
                </center></div>

        </div>      
    </h:body>
</html>
